#!/bin/bash
if [ -z "$1" ]; then
	echo "Usage: $0 <rsync-dest>" >&2
	exit 1
fi
chmod a+rX -R out 2>/dev/null

rm -f out/revcache
./branches.sh -v | while read commit branch junk; do
	echo ":$commit $branch"
	./revlist.sh $branch
done >out/revcache

mkdir -p out/describe
(
	cd build
	for d in ../out/pass/* ../out/fail/*; do
		b=$(basename $d)
		git describe --all --contains --always $b >../out/describe/$b
	done
)
exec rsync -za --no-owner out/. "$1" \
	--exclude '*~'
